package com.example.mq.demo.consumer;

import com.example.mq.demo.model.Message;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RocketMQMessageListener(
        topic = "async-topic",
        consumerGroup = "async-consumer-group"
)
public class AsyncMessageConsumer implements RocketMQListener<Message> {

    @Override
    public void onMessage(Message message) {
        log.info("收到异步消息：{}", message);
    }
}